﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="ext/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
    <script src="ext/ext-all-dev.js" type="text/javascript"></script>
    <script src="ext/ext-lang-es.js" type="text/javascript"></script>
    <script type="text/javascript">
        Ext.onReady(function () {
            //definimos el modelo
            Ext.define('checklist', {
                extend: 'Ext.data.Model',
                idProperty: 'item',
                fields: [
                    { name: 'item', type: 'int' },
                    { name: 'descripcion', type: 'string' },
                //{ name: 'estado', type: 'string'/*, convert: function (v) { return (v=='true') ? 'C' : 'P' }*/ },
                    {name: 'estado', type: 'boolean', defaultValue: false, convert: function (v) {
                        if (v == 'C' || v == true) {
                            return true;
                        }
                        else if (v == 'P' || v == false) {
                            return false;
                        }
                        else
                        { return false; }
                    }
                },
                    { name: 'fecha', type: 'date' },
                    { name: 'checked', type: 'boolean', defaultValue: false }
                ]


            });

            //definimos el store
            var storegrilla = Ext.create('Ext.data.Store', {
                model: 'checklist',
                autoLoad: true,
                autoSync: true,
                autoSave: true,
                autoDestroy: true,
                proxy: {
                    type: 'ajax',
                    url: '/clasesNET/solicitud.ashx',
                    extraParams: { x: 1 }
                }
            });

            Ext.create('Ext.grid.Panel', {
                title : 'Grilla',
                store: storegrilla,
                width: 300,
                columns: [
                    { xtype: 'checkcolumn', width: 30, dataIndex: 'estado', stopSelection: false },
                    { text: 'Tarea', dataIndex: 'descripcion', width: 200, editor: { allowBlank: false} }
                    ],
                renderTo : Ext.getBody()
            });
        });
    </script>
    <title></title>
</head>
<body>

</body>
</html>
